

package com.hazelcast.internal.metrics;

/**
 * Represents an object which publishes a set of metrics to some destination.
 */
public interface MetricsPublisher {

    /**
     * Publish the given metric with a long value.
     */
    void publishLong(MetricDescriptor descriptor, long value);

    /**
     * Publish the given metric with a double value.
     */
    void publishDouble(MetricDescriptor descriptor, double value);

    /**
     * Callback is called after all metrics are published for a given
     * metric collection round.
     */
    default void whenComplete() {
    }

    /**
     * Perform any necessary cleanup before shutdown.
     */
    default void shutdown() {
    }

    /**
     * Name of the publisher, only used for debugging purposes.
     */
    String name();

}
